package com.ruoyi.web.controller.admin;

import com.ruoyi.admin.service.ISearchService;
import com.ruoyi.common.core.domain.AjaxResult;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 检索工具类
 */
@RequestMapping("/search")
@RestController
@RequiredArgsConstructor
public class SearchCollection {


    private final ISearchService searchService;

    /**
     * 向量检索
     *
     * @param text      文本
     * @param labelData 过滤json
     * @param topK      返回条数
     * @return ajax
     */
    @GetMapping
    public AjaxResult search(String text, String labelData, int topK) {
        return AjaxResult.success(searchService.search(text, labelData, new ArrayList<>(), topK));
    }

}
